package ua.kharkiv.khpi.tarasenko.diploma;


public class Item implements Cloneable{
	
	private String item;
	private UserAction userAction;
	
	private Item(String s){
		item = s;
	}
	
	public static Item getItem(String s) {
		Item item = new Item(s.intern());
		return item;
	}	
	
	@Override
	public String toString() {
		return item + "(" + userAction + ")";
	}
	
	public boolean isEmpty() {
		if (item != null) {
			return item.isEmpty();
		} else {
			return false;
		}		
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((item == null) ? 0 : item.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Item other = (Item) obj;
		if (item == null) {
			if (other.item != null)
				return false;
		} else if (!item.equals(other.item))
			return false;
		return true;
	}

	public UserAction getUserAction() {
		return userAction;
	}

	public void setUserAction(UserAction userAction) {
		this.userAction = userAction;
	}
}
